﻿package  {
	
	import flash.display.MovieClip;
	import flash.utils.Timer;
	import flash.events.TimerEvent;
	
	public class m_tile extends MovieClip {

	public var size:int=0;
	public var speed:int=0;
	public var dist:int=0;
	public var c_dist:int=0;

		public function m_tile() {
			// constructor code
			
		}
		
		public function set_tile(_size:int, _speed:int, _dist:int, _c_dist:int){
			size=_size;
			speed=_speed;
			dist=_dist*32;
			c_dist=_c_dist*32;
			
			for(var i=0;i<size;++i){
				
				var x_=i*32-(size/2)*32;
				var new_tile:platform_tile=new platform_tile();
				new_tile.x=x_;
				addChild(new_tile);
				
			}
		}
		
		public function m_update(){
			
			this.x+=speed; c_dist+=speed;
			if(c_dist==dist || c_dist==dist*-1)speed*=-1;
		}

	}
	
}
